<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>登录</title>
    <link href="${pageContext.request.contextPath}/static/css/bootstrap.min-3.4.0.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/font-awesome-4.3.0.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/animate.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/style-2.2.0.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/index.css" rel="stylesheet">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.css">
</head>

<body class="gray-bg" onload="checkForm()">
<div id="form" class="middle-box text-center loginscreen animated fadeInDown">
    <div class="form-signin">
        <div id="stage">
            <div id="inner">
                <div id="cover">
                    <div id="text">
                        <span style="color: cyan;">H</span><span style="color: white;">+</span>
                    </div>
                    <div id="detail"></div>
                    <div id="handle"></div>
                </div>
                <canvas class="mb-4" id="live2d" width="800" height="800"></canvas>
            </div>
            <a id="info" href="javascript:info()"><i class="fa fa-lg fa-info"></i></a>
            <a id="refresh" href="javascript:refresh()"><i class="fa fa-lg fa-refresh"></i></a>
        </div>
        <h3>欢迎使用<br/>打牛蛙组后台管理系统</h3>

        <%
            //获取cookie的数据
            Cookie[] cookies = request.getCookies();
            String name = null;
            String pwd = null;

            if (cookies != null) {
                //循环
                for (Cookie c : cookies) {
                    //根据key获取value
                    if ("userName".equals(c.getName())) {
                        //保存到page作用域
                        session.setAttribute("accountName", c.getValue());
                        name = c.getValue();
                    } else if ("passWord".equals(c.getName())) {
                        session.setAttribute("accountPwd", c.getValue());
                        pwd = c.getValue();
                    }
                }
            }
            if(name!=null && pwd!=null){
                response.sendRedirect("index.jsp");
            }
        %>

        <form id="regForm" class="m-t" role="form" action="/loginContoller/login">
            <div class="form-group">
                <input id="userName" name="userName" type="phone" class="form-control" placeholder="用户名" value="${accountName}"
                       required="">
            </div>
            <div class="form-group">
                <input id="passWord" name="passWord" type="password" class="form-control" placeholder="密码" required="" value="${accountPwd}">
            </div>

            <button type="submit" class="btn btn-primary block full-width m-b">登 录</button>
            <div class="form-group">
                <div class="checkbox i-checks">
                    <label class="no-padding">
                        <input type="checkbox" name="checkboxNum"><i></i>自动登录</label>
                    <span style="padding: 0 10px">|</span>
                    <span class="text-muted text-center"><small>忘记密码？</small><a href="findPwd.jsp">点击找回</a>
                        </span>
                </div>
            </div>
            <img src="static/picture/1.gif" style="width: 100%;">
        </form>
    </div>
    <input id="message" type="hidden" name="message" value="${message}">
</div>
<!-- Mainly scripts -->
<script src="${pageContext.request.contextPath}/static/js/jquery-2.1.1.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/bootstrap.min-3.4.0.js"></script>
<script type="text/javascript">
    function stop() {
        return false;
    }

    document.oncontextmenu = stop;

    function checkForm(){
        if($("#message").val()!=""){
            alert($("#message").val());
        }
    }

</script>
<script src="${pageContext.request.contextPath}/static/js/live2d.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/index.js"></script>


</body>

</html>